package yl.hs.bmipfull.viewmodels.finance;

/*
 * OrderState 发货单状态
 * @category
 * @author 谢景广
 * @date 2021-12-27
 */
public enum OrderState {
    /**
     * 作废
     */
    INVALID((short) -1),
    /**
     * 暂存
     */
    TEMP((short)0),
    /**
     * 已发货
     */
    NORMAL((short)1),
    /**
     * 已签收
     */
    SIGED((short)8),
    /**
     * 已审核
     */
    REVIEWED((short)10),
    /**
     * 已结算
     */
    SETTLED((short)20);
    /**
     * 状态码
     */
    public short code;
    OrderState(short code){
        this.code = code;
    }
    public static OrderState Parser(short code){
        var state = OrderState.TEMP;
        switch (code){
            case 1:
                state = OrderState.NORMAL;
                break;
            case 2:
                state = OrderState.INVALID;
                break;
            case 8:
                state = OrderState.SIGED;
                break;
            case 10:
                state = OrderState.REVIEWED;
                break;
            case 20:
                state = OrderState.SETTLED;
                break;
        }
        return  state;
    }
}
